import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 获取结算单数据
export const getBalanceList = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance`, {
    params
  });

// 取消结算
export const cancelBalance = params =>
  axios.put(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/CancelSettlement`, params, {
    timeout: 600000
  });

// 取消其他结算
export const cancelSettlementOther = params => axios.put(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/CancelSettlementOther`, params);

// 获取结算单明细
export const getBalanceDetail = (ownerCode, balanceNo) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/QueryBalanceDetail/${balanceNo}/${ownerCode}`);

// 维修项目查询
export const getLabourDetail = (ownerCode, balanceNo) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/queryLabourObj/${ownerCode}/${balanceNo}`);

// 维修材料查询
export const queryRoRepairPartByBalanceNo = (ownerCode, balanceNo) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/queryRoRepairPartByBalanceNo/${ownerCode}/${balanceNo}`);

// 销售材料查询
export const querySalesPo = (ownerCode, balanceNo) => axios.get(`${SERVER.DMSCLOUD_FINANCE}//basedata/gatheringManage/querySalesPo/${ownerCode}/${balanceNo}`);

// 附加项目查询
export const getAddPo = (ownerCode, balanceNo) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/queryAddPo/${ownerCode}/${balanceNo}`);

// 实收
export const queryPayObjPo = (ownerCode, balanceNo) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/queryPayObjPo/${ownerCode}/${balanceNo}`);

// 维修项目——根据收费对象代码查明细
export const getLabourPayObject = (ownerCode, itemId) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/queryPayLabourObj/${ownerCode}/${itemId}`);

// 维修材料——根据收费对象代码查明细
export const getPartPayObject = (ownerCode, itemId) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/queryPartObjPo/${ownerCode}/${itemId}`);

// 附加项目——根据收费对象代码查明细
export const getAddItemPayObject = (ownerCode, itemId) => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/gatheringManage/queryAddObjPo/${ownerCode}/${itemId}`);

// 查询是否上传索赔单
export const findNoList = params =>
  axios.get(`${SERVER.AUDI_CLAIM}/claim/claimOrder/findNoList`, {
    params,
    timeout: 600000
  });
// 尊享悦享核销
export const pushHx = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/order/ASC/zyget`, params);
// 获取是否可以取消的状态
export const getStatusByRoNo = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/getStatusByRoNo`, {
    params,
    timeout: 600000
  });

// 更新上次修理时间
// export const updateLastDate = params => axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/updateLastDate`, { params });
export const updateLastDate = roNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/settlement/updateLastTime/${roNo}`);

// 获取是否可以取消的状态
export const checkClaimStatusByRoNo = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/checkClaimStatusByRoNo`, {
    params
  });

// 取消结算会员接口
export const getMemberNOByNo = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/getMemberNOByNo`, {
    params
  });

// 选择装饰派工单列表
export const queryBoutiqueForCancel = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/queryBoutiqueForCancel`, {
    params
  });

export const systemLogForCancelBalance = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/cancelBlance/systemLogForCancelBalance`, {
    params
  });

// 根据工单号获取会员卡信息 roNo
export const queryVipInfoByRono = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/freeSettlement/queryMemberInfoByRoNos`, {
    params
  });

// 根据销售单号或者装饰单号获取会员卡信息 orderType(状态：销售单2，装饰单3) 销售单号：salesPartNo，结算单号：balanceNo 装饰单号：billNo
export const queryVipInfoByBillNo = params =>
  axios.get(`${SERVER.DMSCLOUD_FINANCE}/basedata/freeSettlement/queryMemberInfoByNos`, {
    params
  });
